import random

def generate_winning_numbers():
    """生成一注中奖号码，包含8个1-33的整数"""
    return [random.randint(1, 33) for _ in range(8)]

def check_lottery(ticket, winning_numbers):
    """检查彩票是否中奖，并返回中奖等级"""
    num_correct = sum(1 for num in ticket if num in winning_numbers)
    if num_correct == 8:
        return "一等奖"
    elif num_correct == 7:
        return "二等奖"
    elif num_correct == 6:
        return "三等奖"
    elif num_correct == 5:
        return "四等奖"
    else:
        return "未中奖"

if __name__ == "__main__":
    # 生成一注中奖号码
    winning_numbers = generate_winning_numbers()
    # 用户输入彩票号码
    try:
        user_input = input("请输入8位数字彩票号码，以空格分隔：")
        user_ticket = list(map(int, user_input.split()))

        # 检查中奖等级并打印结果
        result = check_lottery(user_ticket, winning_numbers)
        print("您的中奖结果为:", result)

    except ValueError:
        print("输入的不是有效的数字，请重新输入")
    print("中奖号码为:", winning_numbers)


